package com.lianzhihui.romeex.adapter;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.SunTeamAwardBean;
import com.lianzhihui.romeex.utils.DateUtil;

import java.util.List;

/**
 * Description: 主页适配器
 * Author: RAMON
 * CreateDate: 2020/11/4 8:10 PM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class EarningsActivityAdapter extends BaseQuickAdapter<SunTeamAwardBean.ContentBean, BaseViewHolder> {

    Context mContext;

    public EarningsActivityAdapter(@Nullable Context mContext, @Nullable List<SunTeamAwardBean.ContentBean> data) {
        super(R.layout.item_earnings_layout, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, SunTeamAwardBean.ContentBean item) {
        //"type": 1类型 1为直推 2为社区
        if (item.getType() == 1) {
            helper.setImageResource(R.id.iv_icon, R.drawable.icon_detail_team);
        } else {
            helper.setImageResource(R.id.iv_icon, R.drawable.icon_detail_community);
        }
        helper
                .setText(R.id.time, DateUtil.sec2Date(item.getAddTime()))
                .setText(R.id.reward, item.getBalance() + mContext.getResources().getString(R.string.text_rex));
        //状态 0为发放 1已发放
        TextView tv1 = helper.getView(R.id.isGrant);
        if (item.getIsGrant() == 0) {
            tv1.setTextColor(mContext.getResources().getColor(R.color.text_cccccc_color));
            tv1.setText(mContext.getResources().getString(R.string.text_not_issued));
        } else {
            tv1.setTextColor(mContext.getResources().getColor(R.color.text_F3863B_color));
            tv1.setText(mContext.getResources().getString(R.string.text_issued));
        }


    }
}
